import { Ref, ref } from "vue";

export function theme() {
  // 当前主题。具有默认值
  const currentTheme = ref({
    backgroundColor: "#304156",
    textColor: "#fff",
  });

  // 所有主题
  const allBackgroundColor = ["#304156", "#0380E0", "#50dc32"];

  // 所有字体颜色
  const allTextColor = ["#fff", "#000000", "#50dc32"];

  // 设置主题
  const setTheme = (current: Ref, type: string, color: string) => {
    if (type == "backgroundColor") {
      current.value.backgroundColor = color;
    } else if (type == "textColor") {
      current.value.textColor = color;
    }
  };
  return {
    currentTheme,
    allBackgroundColor,
    allTextColor,
    setTheme,
  };
}
